package com.cskaoyan.wx.controller;

import com.cskaoyan.bean.Comment;
import com.cskaoyan.vo.BaseRespVo;


import com.cskaoyan.wx.bo.WxCommentBO;
import com.cskaoyan.wx.bo.WxCommentPostBO;
import com.cskaoyan.wx.service.WxCommentService;
import com.cskaoyan.wx.vo.CommentCountVO;
import com.cskaoyan.wx.vo.WxCommentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;


@RestController
@RequestMapping("wx")
public class wxCommentController {
    @Autowired
    WxCommentService wxCommentService;

    @GetMapping("comment/list")
    public BaseRespVo commentList(WxCommentBO wxCommentBO){
        WxCommentVO commentVO = wxCommentService.getCommentList(wxCommentBO);
        return BaseRespVo.ok(commentVO);
    }

    @GetMapping("comment/count")
    public BaseRespVo commentCount(Integer valueId,Byte type){
        CommentCountVO commentCountVO = wxCommentService.getCommentCount(valueId,type);
        return BaseRespVo.ok(commentCountVO);
    }

    @PostMapping("comment/post")
    public BaseRespVo commentPost(@RequestBody WxCommentPostBO wxCommentPostBO){
        Comment comment = wxCommentService.commentPost(wxCommentPostBO);
        return BaseRespVo.ok(comment);
    }
}
